<?php
$line=1;
while($line<=5) {
    $empty_pos = $star_pos = 1;
    $empty = 5 - $line;
    $star = 2 * $line - 1;
    while ($empty_pos <= $empty) {
        echo '&nbsp';
        ++$empty_pos;
    }
    while ($star_pos <= $star) {
        echo '*';
        ++$star_pos;
    }
    echo '<br>';
    ++$line;
}

/**
 * Created by PhpStorm.
 * User: lijifeng
 * Date: 2016/9/28
 * Time: 18:28
 */